package edu.pku.hawk.controller.detectmonitor;

import java.io.FileOutputStream;

import edu.pku.hawk.controller.util.Constants;
import edu.pku.hawk.controller.util.MInputStreamQueue;
import edu.pku.hawk.controller.util.MQManager;

public class TestFileListener {

	public static void main(String[] args) {

		MQManager mgr;
		FileOutputStream fos = null;
		try {
			mgr = new MQManager(Constants.MQServer_Name, Constants.MQServer_Password, Constants.MQServer_URL);
			MInputStreamQueue queue = mgr.getInputStreamQueue("FileSend");

			fos = new FileOutputStream("files/qqq.jpg");
			try {

				queue.receive(fos);
			} catch (Exception ex) {
				ex.printStackTrace();
			}

		} catch (Exception ex) {
			ex.printStackTrace();
		} finally {
			try {
				fos.close();
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

	}

}
